package com.hf.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hf.entity.Roles;
import com.hf.entity.UserRoles;
import com.hf.mapper.UserRolesMapper;
import com.hf.service.IUserRolesService;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author eight
 * @since 2021-06-06
 */
@Service
public class UserRolesServiceImpl extends ServiceImpl<UserRolesMapper, UserRoles> implements IUserRolesService {
	@Autowired
	UserRolesMapper userRolesMapper;

	@Override
	public List<Roles> getRolesByUserId(Integer userId) {
		// TODO Auto-generated method stub
		return userRolesMapper.getRolesByUserId(userId);
	}

	@Override
	public boolean deleteByUserIdAndRoleId(Integer userId, String rids) {

		String[] split = rids.split(",");
		return userRolesMapper.deleteByUserIdAndRoleId(userId, split);
	}

	@Override
	public List<UserRoles> getListByUserId(Integer userId) {
		// TODO Auto-generated method stub
		return userRolesMapper.getListByUserId(userId);
	}

	@Override
	public List<UserRoles> getListByRoleId(Integer roleId) {
		// TODO Auto-generated method stub
		return userRolesMapper.getListByRoleId(roleId);
	}

}
